#ifndef AT32F415RCT7_SPI_H
#define AT32F415RCT7_SPI_H
#include "at32f435_437_conf.h"
#include "at32f415_gpio_driver.h"

#define BUFFERSIZE 29800
extern __IO uint8_t spi1_tx_buffer[BUFFERSIZE];
extern __IO uint8_t spi1_cmd_buffer[BUFFERSIZE];
extern __IO uint16_t tx_index;
extern __IO uint16_t pu_index;
extern __IO uint32_t send_ov_flag;

void app_spi_init(void);
void spi_send_byte(uint8_t data);
void spi_dma_config(dma_channel_type* dmax_channely,confirm_state isinc,uint32_t mptr,uint32_t len);
void spi_irq_send_start();
void spi_dma_send_start();
void wait_dma_stop();
#define SPI_CS_HDMODE 1
#define SPI_IRQ_MODE 0
#define SPI_HALF_MODE 0

#define SPI_DMA_MODE 1
#define DMA_ONE_BUFF 1
#define LVGL_DMA 1
#endif